<template>
  <view class="nav-bar">
    <van-nav-bar 
      :title="title"
      :left-text="leftText"
      :right-text="rightText"
      :left-arrow="leftArrow"
      :right-arrow="rightArrow"
      fixed
      @click-left="onClickLeft"
      @click-right="$emit('clickRight')"
    >
      <slot></slot>
      <template #right>
        <slot name="right"></slot>
      </template>
    </van-nav-bar>
  </view>
</template>

<script setup>
defineProps({
  title: String,
  leftText: String,
  rightText: String,
  leftArrow: Boolean,
  rightArrow: Boolean,
})
const onClickLeft = () => {
  console.log('leftArrow');
  uni.navigateBack({ delta: 1 })
};

</script>

<style scoped>
.nav-bar {
  height: 92rpx;
  background-color: #fff;
}
</style>